Recently, a method called H.264 is standardized as a motion image compression coding method. This H.264 coding method requires a larger operation amount than those of the conventional compression coding methods such as MPEG2 and MPEG4, but can realize a higher coding efficiency than those of these conventional methods.
In this H.264 coding method, a context adaptive variable-length coding (CAVLC) method is defined as a variable-length coding method. Syntax elements which form a coded stream in the CAVLC method are the number of nonzero data (to be referred to as TotalCoeff hereinafter) in a block, the number of zero data (to be referred to as TotalZeros hereinafter) input before the last nonzero data in a block, the number of data (to be referred to as TrailingOnes hereinafter) having an absolute value of 1 and input after the last data having an absolute value of 2 or more in a block, the value (to be referred to as Level hereinafter) of nonzero data, and the number of zero data (to be referred to as Run hereinafter) preceding to the nonzero data. Note that in the standard of H.264, the maximum value of TrailingOnes is defined as 3.
This CAVLC method largely differs from the variable-length coding method used in MPEG2 and MPEG4 in the following two points:
1. Level and Run are coded in the reverse scan order.
2. A variable-length coding table necessary for coding of Level and Run is changed in accordance with the calculation results of TotalCoeff, TrailingOnes, and TotalZeros.
An example of a variable-length coding apparatus using the CAVLC method is described in patent reference 1. This variable-length coding apparatus increases the processing speed by coding a plurality of data in parallel by variable-length coding, and sequentially connecting a plurality of generated variable-length coded data (e.g., Japanese Patent Laid-Open No. 2004-056758).
In this variable-length coding apparatus described in Japanese Patent Laid-Open No. 2004-056758, however, a plurality of syntax elements depend on each other, so the processing takes a long time if coding of a second syntax element cannot be started before the calculation of a first syntax element is completed.
For example, in the CAVLC method, after all image data in a block are read out and TotalCoeff, TrailingOnes, and TotalZeros are calculated, the Level and Run of all the image data in the block must be coded in turn from the beginning by variable-length coding. This makes the variable-length coding process time-consuming.